<html>
<head>
<title>Authentication Form</title>
<script type = "text/javascript" src = "ajax.js" ></script>
<script type = "text/javascript" src = "login.js"></script>
<script type = "text/javascript" >
//ajax.js is used to create request objects
//login.js is used to create the login box in a dynamic manner
function formauth()
	{
//gets the usrname and pwd from the textboxes
		usrhandle = document.getElementById("usr").value;
		pwdhandle = document.getElementById("pwd").value;
//creates the ajax request and sets the backend form handler
		var request = createrequest();
		var authenticator = "authenticate.php";
//builds the http request
		request.open("POST",authenticator,true)
//sets the callback function,once the server is back with its response
		request.onreadystatechange = serverresponse;
//adds another header to tell the server to expect form data
		request.setRequestHeader("Content-type","application/x-www-form-urlencoded;");
//the data in the form of url encoded query strings
		request.send("usrname="+usrhandle+"&"+"pwd="+pwdhandle);
//the callback function,this is pretty crude...will require more code
//after the encryption code is up.This will check for authentication,if
//true will destroy the login box and replace it with a logout button.
//i haven't done the logout part yet..doing it today..
	function serverresponse()
	{
		if (request.readyState == 4 && request.status == 200)
		{
			logindestroy();
		}
	}
	}
	


</script>
</head>
<body>
<script>
//this dynamically creates a login box...
	logincreate();
</script>
</body>
</html>

